package com.hxl.tech.gateway.auth.controller;


import com.hxl.tech.gateway.auth.dto.Response;
import com.hxl.tech.gateway.auth.dto.sms.SmsCodeSendDTO;
import com.hxl.tech.gateway.auth.service.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 短信 Controller
 * @author soliddq
 * @date 2023-10-10
 */
@Api(value = "发送短信", tags = "发送短信")
@RestController
@RequiredArgsConstructor
public class SmsController {

    private final SmsService smsService;

    @PostMapping("gateway.auth.sms.code.send")
    @ApiOperation(value = "短信验证码", response = void.class)
    public Response saveRegister(@RequestBody @Validated SmsCodeSendDTO sendDTO) {

        smsService.sendCode(sendDTO.getPhone());
        return Response.createSuccess();
    }


}
